from selenium.webdriver.common.by import By

from autoTest_ecshop.base_page.base import BasePage


class HomePage(BasePage):
    # 获取搜索框定位器
    sInput_loc = (By.XPATH,'//*[@id="keyword"]')
    # 获取搜索按钮定位器
    sBtn_loc = (By.XPATH,'//*[@id="searchForm"]/input[@name="imageField"]')
    # 获取商品定位器
    shop_loc = (By.XPATH, '//*[@id="compareForm"]/div/div/div[1]/a[1]')
    # 获取主页按钮定位器
    index_page = (By.XPATH,'//*[@id="mainNav"]/a[1]')

    def search_Products(self,value):
        self.btn_click(self.index_page)
        self.input_data(self.sInput_loc,value)
        self.btn_click(self.sBtn_loc)